<template>
  <div class="content">
    <el-button type="primary" @click="handleAddAlarm">+ 添加配置</el-button>
    <el-table style="width: 100%;margin-top: 20px;">
      <el-table-column prop="" label="标题"></el-table-column>
      <el-table-column prop="" label="api地址"></el-table-column>
      <el-table-column prop="" label="创建时间"></el-table-column>
      <el-table-column prop="" label="状态"></el-table-column>
      <el-table-column prop="" label="报文类型"></el-table-column>
      <el-table-column label="操作">
        <template>
          <el-button size="small" type="success" @click="handleEdit">数据格式</el-button>
          <el-button size="small" type="primary" @click="handleEdit">修改</el-button>
          <el-button size="small" type="danger" @click="handleDelete">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination-container">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
        :page-sizes="[10, 20, 30, 40, 50, 100]" :page-size="pageSize" :current-page="currentPage"
        layout="total, prev, pager, next, sizes, jumper" :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
// 添加报警条件
const handleAddAlarm = () => {

}
// 修改
const handleEdit = () => {

}
// 删除
const handleDelete = () => {

}
// 分页
const currentPage = ref(1)
const pageSize = ref(10)
const total = ref(0)
const handleSizeChange = (val: number) => {
  pageSize.value = val
  console.log(`每页 ${val} 条`)
}
const handleCurrentChange = (val: number) => {
  currentPage.value = val
  console.log(`当前页: ${val}`)
}

</script>

<style scoped>
.content {
  width: 100%;
  height: 100%;
  font-size: 14px;
  background-color: #ffffff;
  padding: 20px;
}

:deep(.el-table) {
  border: 1px solid #ebeef5;
}

:deep(.el-table th) {
  background-color: #f5f7fa;
  color: #101010;
  font-weight: 600;
  text-align: center;
}

:deep(.el-table td) {
  padding: 12px 0;
}

:deep(.el-button) {
  margin-right: 8px;
}

.pagination-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
</style>
